package cn.hbu.zlfw.dic.dao.impl;

import org.springframework.stereotype.Repository;

import cn.hbu.zlfw.common.base.dao.impl.BaseDaoImpl;
import cn.hbu.zlfw.common.util.PageModel;
import cn.hbu.zlfw.dic.dao.DicSubjectDao;
import cn.hbu.zlfw.dic.entity.DicPrimarySubject;
import cn.hbu.zlfw.dic.entity.DicSubject;
/**
 * 
 * @ClassName: DicSubjectDaoImpl 
 * @Description: 学科字典表dao接口实现
 * @author 王鹏伟<1223443289@qq.com>
 * @date 2017年11月7日 下午9:49:36  
 * @version V1.0
 */
@Repository("dicSubjectDao")
public class DicSubjectDaoImpl extends BaseDaoImpl<DicSubject, String> implements DicSubjectDao{
	
	//通过状态吗去查询一级学科DicPrimarySubject
	@Override
	public String getSubjectByCode(Integer typeCode) {
		System.out.println("_______________"+typeCode);
		return ((DicPrimarySubject) this.getSession()
				.createQuery("from DicPrimarySubject where typeCode=:typeCode")
				.setParameter("typeCode", typeCode)
				.uniqueResult()).getDescription();
	}
	/*
	 * (non-Javadoc)
	 * @see cn.hbu.zlfw.dic.dao.DicSubjectDao#listSubjectsToRoot(cn.hbu.zlfw.common.util.PageModel)
	 */
	@Override
	public PageModel<DicSubject> listSubjectsToRoot(PageModel<DicSubject> pageModel) {
		return this.findListByParams("from DicSubject", null, null, pageModel);
	}
}
